package com.et.launch

import com.et.logger.ELog
import com.et.logger.TAGS

class AppCrashHandler : Thread.UncaughtExceptionHandler {

    private val handlerThread = Thread.getDefaultUncaughtExceptionHandler()

    override fun uncaughtException(t: Thread, e: Throwable) {
        handlerThread?.uncaughtException(t, e)
        ELog.d(TAGS.launch, "e.stackTraceToString()")
        ELog.d(TAGS.launch, e.stackTraceToString())
    }

    companion object {
        fun register() {
            Thread.setDefaultUncaughtExceptionHandler(AppCrashHandler())
        }
    }

}